import 'package:base_flutter/base_flutter.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:ls_work/model/office_model.dart';
import 'package:ls_work/net/response/office_list_tree_data.dart';

class OfficeListViewModel extends BaseListViewModel<OfficeListTreeData>{
  OfficeListViewModel(BuildContext context) : super(context);

  var officeModel = OfficeModel();

  List<OfficeListTreeData> selectOffice = [];

  List<OfficeListTreeData> get dataList => selectOffice.isEmpty?listItems:selectOffice.last.children??[];

  @override
  Future<List<OfficeListTreeData>> requestListData() async {
   return await officeModel.officeListTree();
  }

  @override
  void onCreated() {
    super.onCreated();
    requestRefresh(showAni: false);
  }
}